﻿@model MTQ.Model.Base_KeyValue
@using MTQ.BLL
@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_Layout_lay_admin.cshtml";
}

<style>
    body {
        background-color: #ffffff;
    }
</style>

<div class="layui-form layuimini-form">
    <div class="layui-form-item hidden" style="display:none;">
        <label class="layui-form-label required">ID</label>
        <div class="layui-input-block">
            <input type="text" name="KeyValue_Id" lay-verify="required" value="@Model.KeyValue_Id" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">@ViewBag.KeyValueName</label>
        <div class="layui-input-block">
            <input type="text" name="KeyValue_Name" placeholder="" value="@Model.KeyValue_Name" autocomplete="off" lay-verify="required" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">顺序</label>
        <div class="layui-input-block">
            <input type="text" name="KeyValue_Sort" placeholder="请输入顺序" value="@Model.KeyValue_Sort" autocomplete="off" onkeyup="value=value.replace(/[^\d]/g, '')" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注信息</label>
        <div class="layui-input-block">
            <textarea name="KeyValue_Remark" class="layui-textarea" placeholder="请输入备注信息">@Model.KeyValue_Remark</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>

<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {

            $.ajax({
                url: '/Base_KeyValue/Edit',
                type: 'post',
                dataType: 'text',
                data: data.field,
                success: function (resp) {
                    var json = eval('(' + resp + ')');
                    var index = layer.alert(json.Message, function () {
                        // 关闭弹出层
                        layer.close(index);
                        parent.reloadTable();
                        var iframeIndex = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(iframeIndex);
                    });
                },
                error: function (resp) {
                    layer.alert("对不起出错了");
                }
            });


            return false;
        });

    });
</script>



